<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileoverview 设置为主图功能，本来想作为插件去写，但是发现这么简单的功能不适合做插件，做成插件反而复杂了。
<span class='line'>  3</span>  * @author 紫英（橘子）&lt;daxingplay@gmail.com>
<span class='line'>  4</span>  * @date 2012-03-07
<span class='line'>  5</span>  * @requires KISSY 1.2+
<span class='line'>  6</span>  */</span><span class="WHIT">
<span class='line'>  7</span> </span><span class="NAME">KISSY.add</span><span class="PUNC">(</span><span class="STRN">'gallery/form/1.2/uploader/themes/ershouUploader/setMainPic'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">S</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Node</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>  8</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>  9</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Node.all</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 10</span> </span><span class="WHIT">		</span><span class="NAME">LOG_PRE</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'[LineQueue: setMainPic] '</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 11</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 12</span> </span><span class="WHIT">	</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">SetMainPic</span><span class="PUNC">(</span><span class="NAME">mainPicInput</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queueContainer</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT">			</span><span class="NAME">mainPicInput</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">mainPicInput</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT">			</span><span class="NAME">queueContainer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">queueContainer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="WHIT">		</span><span class="COMM">// config = S.mix(_config, config);</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">mainPicInput</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">mainPicInput.length</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="WHIT">			</span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PRE</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'cannot find mainPicInput, SetMainPic function disabled.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 20</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">queueContainer</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">queueContainer.length</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT">			</span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PRE</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'cannot find queue container'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">		</span><span class="NAME">self.queueContainer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">queueContainer</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">		</span><span class="NAME">self.input</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">mainPicInput</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">	</span><span class="NAME">S.augment</span><span class="PUNC">(</span><span class="NAME">SetMainPic</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 31</span> 		 * 将队列项设置为主图
<span class='line'> 32</span> 		 * @param {HTMLElement|String} liElem 需要设置主图的li元素或者是主图路径
<span class='line'> 33</span> 		 */</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">		</span><span class="NAME">setMainPic</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">liElem</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">				</span><span class="COMM">// container = self.container,</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">				</span><span class="NAME">queueContainer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.queueContainer</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">				</span><span class="NAME">uploadQueue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'li'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queueContainer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">S.isString</span><span class="PUNC">(</span><span class="NAME">liElem</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 40</span> </span><span class="WHIT">				</span><span class="NAME">S.each</span><span class="PUNC">(</span><span class="NAME">uploadQueue</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="WHIT">					</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'data-url'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">					</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">liElem</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">						</span><span class="NAME">liElem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">						</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">					</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT">	</span><span class="NAME">curMainPic</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.getMainPic</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">				</span><span class="NAME">liElem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">liElem</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">liElem</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">liElem.length</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">				</span><span class="COMM">// var uploadQueue = $('li', queueContainer);</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">				</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">uploadQueue</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">					</span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PRE</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'There is no pic. I cannot set any pic as main pic. So I will empty the main pic input.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">					</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">self.input</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">val</span><span class="PUNC">(</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">					</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">					</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">curMainPic.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">						</span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PRE</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'Already have a main pic. Since you do not tell me which one to set as main pic, I will do nothing.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">						</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">curMainPic</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">					</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">						</span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PRE</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'No li element specified. I will set the first pic as main pic.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">						</span><span class="NAME">liElem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">uploadQueue</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">					</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT">	</span><span class="NAME">liWrapper</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'.J_Wrapper'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">liElem</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">				</span><span class="NAME">mainPicLogo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span class="main-pic-logo">主图&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">				</span><span class="NAME">mainPicUrl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">liElem</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'data-url'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">curMainPic.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">				</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">curMainPic</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">'main-pic'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">				</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'.main-pic-logo'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">curMainPic</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">			</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">liElem</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">'main-pic'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">			</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">mainPicLogo</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">appendTo</span><span class="PUNC">(</span><span class="NAME">liWrapper</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">			</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">self.input</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">val</span><span class="PUNC">(</span><span class="NAME">mainPicUrl</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">			</span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PRE</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'write main pic url to :'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">mainPicUrl</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">liElem</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 81</span> 		 * 获取当前主图所在li
<span class='line'> 82</span> 		 */</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">		</span><span class="NAME">getMainPic</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">self.queueContainer</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">(</span><span class="STRN">'.main-pic'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 88</span> 		 * 获取当前主图的路径
<span class='line'> 89</span> 		 */</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">		</span><span class="NAME">getMainPicUrl</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">self.input</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">val</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">	</span><span class="COMM">// S.extend(SetMainPic, Base, {</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="COMM">// 		</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">		</span><span class="COMM">// _init: function(){</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">			</span><span class="COMM">// var self = this,</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT">				</span><span class="COMM">// container = $(self.get('container'));</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">			</span><span class="COMM">// if(!container || container.length &lt;= 0){</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">				</span><span class="COMM">// S.log(LOG_PRE + 'cannot find container');</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">				</span><span class="COMM">// return false;</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">			</span><span class="COMM">// }</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">		</span><span class="COMM">// },</span><span class="WHIT">
<span class='line'>106</span> </span><span class="COMM">// 		</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">		</span><span class="COMM">// /**</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">		 </span><span class="COMM">// * 将所选id的图片设置为主图</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">		 </span><span class="COMM">// */</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">		</span><span class="COMM">// setMainPic: function(id){</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT">			</span><span class="COMM">// var self = this;</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">		</span><span class="COMM">// },</span><span class="WHIT">
<span class='line'>113</span> </span><span class="COMM">// 		</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">		</span><span class="COMM">// /**</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">		 </span><span class="COMM">// * 获取当前主图</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">		 </span><span class="COMM">// */</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT">		</span><span class="COMM">// getMainPic: function(){</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">			</span><span class="COMM">// var self = this;</span><span class="WHIT">
<span class='line'>119</span> </span><span class="COMM">// 			</span><span class="WHIT">
<span class='line'>120</span> </span><span class="WHIT">		</span><span class="COMM">// }</span><span class="WHIT">
<span class='line'>121</span> </span><span class="COMM">// 		</span><span class="WHIT">
<span class='line'>122</span> </span><span class="WHIT">	</span><span class="COMM">// }, {</span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT">		</span><span class="COMM">// ATTRS: {</span><span class="WHIT">
<span class='line'>124</span> </span><span class="COMM">// 			</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">			</span><span class="COMM">// 'mainPicInput': {</span><span class="WHIT">
<span class='line'>126</span> </span><span class="WHIT">				</span><span class="COMM">// value: '#J_MainPic'</span><span class="WHIT">
<span class='line'>127</span> </span><span class="WHIT">			</span><span class="COMM">// },</span><span class="WHIT">
<span class='line'>128</span> </span><span class="WHIT">			</span><span class="COMM">// 'container': {</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT">				</span><span class="COMM">// value: ''</span><span class="WHIT">
<span class='line'>130</span> </span><span class="WHIT">			</span><span class="COMM">// }</span><span class="WHIT">
<span class='line'>131</span> </span><span class="COMM">// 			</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT">		</span><span class="COMM">// }</span><span class="WHIT">
<span class='line'>133</span> </span><span class="WHIT">	</span><span class="COMM">// });</span><span class="WHIT">
<span class='line'>134</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>135</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">SetMainPic</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>136</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>137</span> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">	</span><span class="NAME">requires</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">		</span><span class="STRN">'node'</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">	</span><span class="PUNC">]</span><span class="WHIT">
<span class='line'>141</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>